package com.newworld.basketballfire.service.exception;

import lombok.Getter;
import lombok.Setter;
import org.springframework.http.HttpStatus;

/**
 * Created by George on 2018/7/29.
 * ServiceException
 */

@Getter
@Setter
public class ServiceException extends Exception {

    private int code = HttpStatus.INTERNAL_SERVER_ERROR.value();

    private String id = "error_code.internal_server_error";

    public ServiceException(int code) {
        this.code = code;
    }

    public ServiceException(int code, String message) {
        super(message);
        this.code = code;
    }

    public ServiceException(int code, String id, String message) {
        super(message);
        this.code = code;
        this.id = id;
    }

    public ServiceException(HttpStatus code, String message) {
        this(code.value(), message);
    }

    public ServiceException(HttpStatus code, String id, String message) {
        this(code.value(), id, message);
    }
}
